package 集合框架;

import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Set;

public class Linkedkisttrst {
    public static void main(String[] args) {
        LinkedList linkedList=new LinkedList();
        NewsTitle newsTitle1=new NewsTitle("a",1,"zhuo sir");
        NewsTitle newsTitle2=new NewsTitle("b",2,"zhang sir");
        NewsTitle newsTitle3=new NewsTitle("c",3,"wang sir");
        linkedList.add(newsTitle2);
        linkedList.addFirst(newsTitle3);
        linkedList.addLast(newsTitle1);
        NewsTitle newsTitle=(NewsTitle)linkedList.getLast();
        //System.out.println(newsTitle.title);
        for (int i=0;i<linkedList.size();i++){
            NewsTitle title=(NewsTitle)linkedList.get(i);
            System.out.println(title.title);


        }
        Set set=new HashSet();
        String s1=new String("jj");
        String s2=s1;
        String s3=new String("ss");
        set.add(s1);
        set.add(s2);
        set.add(s3);
        System.out.println(set.size());
        Iterator it=set.iterator();//迭代器
        while(it.hasNext()){
            String t=(String)it.next();
            System.out.println(t);
        }


    }


}
